package com.lams.action.system;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

import com.lams.action.SubAction;
import com.lams.service.system.IButtonFacade;
import com.lams.util.ResultEntity;
import com.opensymphony.xwork2.ActionContext;

public class ButtonAction extends SubAction {
	private IButtonFacade bf;
	
	public IButtonFacade getBf() {
		return bf;
	}


	public void setBf(IButtonFacade bf) {
		this.bf = bf;
	}


	/**
	 * 
	 */
	private static final long serialVersionUID = -9157417002839854152L;
	
	
	public String getBtn(){
		
		Map session = ActionContext.getContext().getSession();
		ResultEntity result = new ResultEntity();
		if(session.get("role")==null){
			result.setSuccess(false);
			result.setMessage("尚未登陆");
			return SUCCESS;
		}
		List<Integer> roles = (List<Integer>) session.get("role");
		List list = bf.getButtonByRole(roles.get(0));
		result.setSuccess(true);
		result.setData(list);
		this.setResult(ResultEntity.decode(result));
		System.out.println(this.getResult());
		return SUCCESS;
	}
	
}
